﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;

using EF.Util.DBUtility;

namespace EF.DAL.Base
{
    public class MenuDAO
    {
        /// <summary>
        /// 获取角色的菜单
        /// </summary>
        /// <param name="roleId">角色Id</param>
        /// <param name="lang">语言(zh-cn,en-us,ja)</param>
        /// <returns></returns>
        public DataTable GetMenu(string role, string lang)
        {
            SqlParameter[] sqlparams = {
                                           new SqlParameter("@role", SqlDbType.NVarChar, 50),
                                           new SqlParameter("@lang", SqlDbType.NVarChar, 10)
                                       };

            sqlparams[0].Value = role;
            sqlparams[1].Value = lang;

            SqlDataReader dr = DbHelperSQL.RunProcedure("spBaseMenuGet", sqlparams);
            DataTable dt = new DataTable();
            dt.Load(dr);
            dr.Close();

            return dt;
        }
    }
}
